package com.zjs.mq.rabbitmq.controller;

import com.util.result.Message;
import com.zjs.mq.rabbitmq.service.RabbitMqService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Description RabbitMQ消息测试控制器
 * @Author zhu_js
 * @Date 2020/1/15 14:07
 * @Version 1.0
 */
@Slf4j
@RequestMapping("/RabbitMQ")
@RestController
public class RabbitMqController {

    @Resource
    private RabbitMqService rabbitMqService;

    /**
     * 通过直连交换机发送消息
     */
    @RequestMapping("/sendMessageByDirect")
    public Message sendMessageByDirect(){
        return rabbitMqService.sendMessageByDirect();
    }

    /**
     * 通过主题交换机发送消息
     */
    @RequestMapping("/sendMessageByTopic")
    public Message sendMessageByTopic(){
        return rabbitMqService.sendMessageByTopic();
    }

    /**
     * 通过扇形交换机发送消息
     */
    @RequestMapping("/sendMessageByFanout")
    public Message sendMessageByFanout(){
        return rabbitMqService.sendMessageByFanout();
    }

    /**
     * 通过首部交换机发送消息
     */
    @RequestMapping("/sendMessageByHeaders")
    public Message sendMessageByHeaders(){
        return rabbitMqService.sendMessageByHeaders();
    }
}
